# Copyright 2018- The Pixie Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("//bazel:pl_build_system.bzl", "pl_go_test")

go_library(
    name = "agent",
    srcs = [
        "agent.go",
        "agent_store.go",
    ],
    importpath = "px.dev/pixie/src/vizier/services/metadata/controllers/agent",
    visibility = ["//src/vizier:__subpackages__"],
    deps = [
        "//src/api/proto/uuidpb:uuid_pl_go_proto",
        "//src/shared/k8s",
        "//src/shared/k8s/metadatapb:metadata_pl_go_proto",
        "//src/shared/types/gotypes",
        "//src/utils",
        "//src/vizier/messages/messagespb:messages_pl_go_proto",
        "//src/vizier/services/metadata/metadatapb:service_pl_go_proto",
        "//src/vizier/services/metadata/storepb:store_pl_go_proto",
        "//src/vizier/services/shared/agentpb:agent_pl_go_proto",
        "//src/vizier/utils/datastore",
        "//src/vizier/utils/messagebus",
        "@com_github_gofrs_uuid//:uuid",
        "@com_github_gogo_protobuf//proto",
        "@com_github_nats_io_nats_go//:nats_go",
        "@com_github_prometheus_client_golang//prometheus",
        "@com_github_prometheus_client_golang//prometheus/promauto",
        "@com_github_sirupsen_logrus//:logrus",
    ],
)

pl_go_test(
    name = "agent_test",
    srcs = ["agent_test.go"],
    deps = [
        ":agent",
        "//src/carnot/planner/distributedpb:distributed_plan_pl_go_proto",
        "//src/shared/bloomfilterpb:bloomfilter_pl_go_proto",
        "//src/shared/k8s/metadatapb:metadata_pl_go_proto",
        "//src/shared/metadatapb:metadata_pl_go_proto",
        "//src/shared/types/gotypes",
        "//src/utils",
        "//src/utils/testingutils",
        "//src/vizier/messages/messagespb:messages_pl_go_proto",
        "//src/vizier/services/metadata/controllers/testutils",
        "//src/vizier/services/metadata/storepb:store_pl_go_proto",
        "//src/vizier/services/shared/agentpb:agent_pl_go_proto",
        "//src/vizier/utils/datastore/pebbledb",
        "@com_github_cockroachdb_pebble//:pebble",
        "@com_github_cockroachdb_pebble//vfs",
        "@com_github_gofrs_uuid//:uuid",
        "@com_github_gogo_protobuf//proto",
        "@com_github_nats_io_nats_go//:nats_go",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
    ],
)
